package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetMealDishMapper {
    /**
     * 根据菜品id集合查询套餐id集合
     * @param dishIds
     * @return
     */
    List<Long> getSetMealIdsByDishIds(List<Long> dishIds);

    /**
     * 新增套餐和菜品关系
     * @param setMealDishList
     */
    void insert(List<SetmealDish> setMealDishList);

    /**
     * 根据套餐Id查询相关套餐菜品
     * @param SetMealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{SetMealId}")
    List<SetmealDish> getBySetMealId(Long SetMealId);

    /**
     * 根据套餐Id删除相关套餐菜品
     * @param setMealId)
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setMealId)}")
    void deleteBySetMealId(Long setMealId);

    /**
     *  根据套餐Ids删除相关套餐菜品
     * @param setMealIds
     */
    void deleteBySetMealIds(List<Long> setMealIds);
}
